import numpy as np
#laminaProp = ( e1, e2, nu12, g12, g13, g23, tempref )
materials = {
            'mat_huehne_2008':\
            (125.774e3, 10.03e3, 0.271, 5.555e3, 5.555e3, 3.4e3, 273.15),
            'degenhardt_2010_IM78552_cocomat':\
            (142.5e3  ,   8.7e3,  0.28,   5.1e3,   5.1e3, 5.1e3, 273.15),
            'degenhardt_2010_IM78552_isa':\
            (157.4e3  ,   8.6e3,  0.28,   5.3e3,   5.3e3, 5.3e3, 273.15),
            'degenhardt_2010_IM78552_posicoss':\
            (146.5e3  ,   9.7e3,  0.31,   6.1e3,   6.1e3, 6.1e3, 273.15),
            'M40J/977-2':\
            (142.5e3  ,   8.7e3,  0.28,   5.1e3,   5.1e3, 5.1e3, 273.15),
            }
#allowables = ( s11t,s11c,s22t,s22c,s12,s13 )
allowables = {
    'degenhardt_2010_IM78552_cocomat': (1741.,-855.,29.,-283.,98.,90.),
            }
conecylDB = {
    'astrium_des1': {
        'r': 2702.5,
        'h': 2064.0,
        'numel_r': 240.,
        'plyt':0.125,
        'alphadeg': 41.28796038,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 0.5,
        'reflimitdisp': 0.24, 
        'reflimitload': 16200.,
        'pload': 10.,
        },
    'astrium_des2': {
        'r': 1968,
        'h': 783,
        'numel_r': 240.,
        'plyt':0.125,
        'alphadeg': 39.9563869,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 0.5,
        'reflimitdisp': 0.24, 
        'reflimitload': 16200.,
        'pload': 10.,
        },

    # laminate maximum of classical buckling load
    'huehne_2002_z30': {
        'r': 250.,
        'h': 510.,
        'numel_r': 180.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [30., -30., 90., 90., 22., -22., 38., -38., 53., -53. ],
        'axialdispl': 1.,
        'pload': 10.,
        },
    # laminate far from minimum and maximum classical buckling load
    'huehne_2002_z33': {
        'r': 250.,
        'h': 510.,
        'numel_r': 180.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [0.,0.,19.,-19.,37.,-37.,45.,-45.,51.,-51.],
        'axialdispl': 1.,
        'pload': 10.,
        },
    # laminate minimum of classical buckling load
    'huehne_2002_z24': {
        'r': 250.,
        'h': 510.,
        'numel_r': 180.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [51., -51., 45., -45., 37., -37., 19., -19., 0., 0.],
        'axialdispl': 1.,
        'pload': 10.,
        },
    'huehne_2008_z07': {
        'r': 250.,
        'h': 510.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 1.,
        'reflimitdisp': 0.24, 
        'reflimitload': 16200.,
        'pload': 10.,
        },
    'dinkler2010_XXX': {
        'r': 100.,
        'h': 100.,
        'elsize': 5.,
        'plyt': 0.125,
        'stack': [ 0., 0., 0., 90.],
        'reflimitload': (145.3 * 2 * np.pi * 100.),
        'laminaprop': materials['mat_huehne_2008'],
        },
    'r_100_h_100': {
        'r': 100.,
        'h': 100.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 1.,
        'pload': 10.,
        },
    'r_100_h_200': {
        'r': 100.,
        'h': 200.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 1.,
        'pload': 10.,
        },
    'r_100_h_400': {
        'r': 100.,
        'h': 400.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 1.,
        'pload': 10.,
        },
    'r_100_h_600': {
        'r': 100.,
        'h': 600.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 1.,
        'pload': 10.,
        },
    'r_100_h_800': {
        'r': 100.,
        'h': 800.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.],
        'axialdispl': 1.,
        'pload': 10.,
        },
    'r_200_h_800': {
        'r': 200.,
        'h': 800.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.]*2,
        'axialdispl': 2.,
        'pload': 20.,
        },
    'r_200_h_400': {
        'r': 200.,
        'h': 400.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.]*2,
        'axialdispl': 2.,
        'pload': 20.,
        },
    'r_300_h_800': {
        'r': 300.,
        'h': 800.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.]*3,
        'axialdispl': 4.,
        'pload': 40.,
        },
    'r_400_h_200': {
        'r': 400.,
        'h': 200.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.]*4,
        'axialdispl': 4.,
        'pload': 40.,
        },
    'r_400_h_800': {
        'r': 400.,
        'h': 800.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['mat_huehne_2008'],
        'stack': [24., -24., 41., -41.]*4,
        'axialdispl': 4.,
        'pload': 40.,
        },
        
    'michal_cone': {
        'r': 250.,
        'h': 500.,
        'numel_r':  180.,
        'artificial_damping': True,
        'plyt':0.125,
        'laminaprop': materials['M40J/977-2'],
        'stack': [24.,-24.,41.,-41.],
        'axialdispl': 10.,
        'pload': 0.,
        },

    'astrium_ESC-A_Cone3936': {
        'r': 1968.,
        'h': 776.27117054125858,
        'alphadeg': 40.2,
        'numel_r':  240.,
        'plyt':0.250,
        'laminaprop': materials['M40J/977-2'],
        'stack': [0]*28,
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'astrium_1_Test_Cone3936': {
        'r': 400.,
        'h': 150.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [0,45,0,-45,90,90,-45,0,45,0],
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'astrium_1_less_2x0_plies': {
        'r': 400.,
        'h': 150.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [0,45,-45,90,90,-45,45,0],
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'astrium_1_less_2x0_plies_45_out': {
        'r': 400.,
        'h': 150.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [45,-45,0,90,90,0,-45,45],
        'axialdispl': 1.0,
        'pload': 20.,
        'stabilizationMagnitude':4.e-7,
        },
    'astrium_1_less_3x0_plies': {
        'r': 400.,
        'h': 150.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [45,-45,90,0,90,-45,45],
        'axialdispl': 1.0,
        'pload': 10.,
        'stabilizationMagnitude':4.e-7,
        },
    'astrium_2_Test_Cone3936': {
        'r': 400.,
        'h': 150.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [45,0,-45,90,-45,0,45,45,0,-45,90,-45,0,45],
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'astrium_3_Test_Cone3936': {
        'r': 400.,
        'h': 200.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [0,45,0,-45,90,0,0,90,-45,0,45,0],
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'astrium_3_less_2x0_plies_45_out': {
        'r': 400.,
        'h': 200.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [45,-45,0,90,0,0,90,0,-45,45],
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'astrium_3_less_4x0_plies_45_out': {
        'r': 400.,
        'h': 200.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [45,-45,90,0,0,90,-45,45],
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'astrium_3_less_5x0_plies_45_out': {
        'r': 400.,
        'h': 200.,
        'alphadeg': 45.,
        'numel_r': 240.,
        'plyt':0.125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [45,-45,90,0,90,-45,45],
        'axialdispl': 1.0,
        'pload': 20.,
        },
    'degenhardt_2010_Z15U500': {
        'r': 250.27,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.11575,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z17U500': {
        'r': 250.35,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.11525,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z18U500': {
        'r': 250.30,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.1195,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z20U500': {
        'r': 250.30,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.12225,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z21U500': {
        'r': 250.24,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.12125,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z22U500': {
        'r': 250.30,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.1215,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z23U500': {
        'r': 250.23,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.1195,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z24U500': {
        'r': 250.22,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.12375,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z25U500': {
        'r': 250.24,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.117,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },
    'degenhardt_2010_Z26U500': {
        'r': 250.27,
        'h': 500.,
        'numel_r': 240.,
        'plyt':0.1195,
        'laminaprop': materials['degenhardt_2010_IM78552_cocomat'],
        'allowables': allowables['degenhardt_2010_IM78552_cocomat'],
        'stack': [24,-24,41,-41],
        'axialdispl': 10.,
        'pload': 20.,
        },

        }


        

